AssetWise CONNECT Edition Implementation Guide

Defining the Data Import and Export Mapping File Format

AssetWise Import and Export allows users to import data from Microsoft Excel file into AssetWise. Excel files can have different number of sheets and columns. In order to be able to be able to interpret Excel data, AssetWise Import and Export uses data import and export mapping files, which are XML files and can be created by system administrators to define what users can import or export from AssetWise. These files map Excel sheets and columns into AssetWise objects and properties. A simple mapping resembles the following:

<mappings>
  <sheets>
    <sheet name="Scopes" header_row="1" start_row="2" export_enabled="false"
           state_column_name="Status" message_column_name="Error Message">
      <objects>
        <object type="Scope">
          <properties>
            <property name="Action" column_name="Action" />
            <property name="Name" column_name="Scope Name" />
           <property name="IsEnabled" column_name="Enabled" />
          </properties>
          <links/>
          <attributes/>
        </object>
      </objects>
      <export/>
    </sheet>
  </sheets>
</mappings>

<mappings> Section

The <mappings> section wraps all definitions and supports the following attributes:

  • type – can be "Provisioning" or anything else. If type="Provisioning" then AssetWise Import and Export activates Global scope before importing anything, otherwise the default user scope is used.
  • export_format – must be "xlsx".

<sheets> Section

The <sheets>section defines all sheets, which must exist in the Excel file. In the example above, the Excel file must contain the Scopes sheet, for example, sheet name="Scopes". It is possible to define additional sheets by adding <sheet> sections. The <sheets> section supports the following attributes:

  • start_row – the number of an Excel row, which contains the first row of data to be imported
  • header_row – the number of an Excel row, which contains column headers, which are used in the <properties> section to map Excel columns to AssetWise object properties and attributes
  • export_enabled – defines whether a particular sheet can be exported
  • state_column_name – the Excel column name (must be in the header_row row), used to log status of the import operation for a particular Excel row. Statuses can be: SUCCESS (there was no error while importing the row; the row was skipped), FAILURE (there was an error and its detail description is stored in the column name defined by the message_column_name attribute), or SKIPPED (the row was skipped).

<sheet> Section

AssetWise Import and Export supports the ability to define a sheet that allows users to select which sheets should be imported instead of processing all sheets defined in a mapping file. This "controlling" sheet must be defined in a mapping file using the following syntax:

    <sheet name="Sheets" type="control" start_row="2">
      <properties>
        <property name="allowed" value="A" />
        <property name="sheetname" value="B" />
      </properties>
    </sheet>
There can be only one sheet with type="control". Such sheet supports the following properties:
  • allowed – defines whether or not a particular sheet should be imported. Valid values are: "Y" or "N"; value – defines the Excel column number
  • sheetname – defines name of the Excel sheet, which must exist in the Excel file; value – defines the Excel column number within that sheet.

<objects> Section

The <objects> section defines what AssetWise objects and their properties will be stored in each Excel row. It is possible to define several <object> sections if there is a need to import several AssetWise objects in one transaction. Each Excel row is considered as a separate database transaction.

An <object> section defines what AssetWise object is targeted, and supports only one attribute:

  • type – defines the AssetWise object type. AssetWise Import and Export supports object types, which in most cases match supported eQL objects.
An <object> section supports the following subsections:
  • <properties> – this section maps AssetWise object properties with Excel columns
  • <links> – this section defines intrinsic and named relationships
  • <attributes> – this section maps object attributes with Excel columns

<properties> Section

The <properties> section defines mappings between Excel columns and AssetWise object properties, which are fixed and not configurable by users, for example, Name, Description, or Code.

The <properties> section can have multiple <property> sections and each <property> section must have the following attributes:

  • name – defines name of the property.

    Note: All unknown or incorrectly defined properties are ignored by AssetWise Import and Export and are not acknowledged by a warning or error message.
  • column_name – defines name of the Excel column, which will be used to import values for the specified property. Column names are case-insensitive.

In addition to object properties, AssetWise Import and Export supports several special properties, which control how objects are being imported:

  • name="Action" – this property whether the object should be created, updated, deleted or just searched while importing. Property value can be mapped to a column (using column_name) or fixed value (eg. <property name="Action" value="UPDATE"/>). Excel column value or property value can be one of the following: CREATE (the object should be created), UPDATE (the object should exist and should be updated), DELETE (the object should be deleted), READ (the object should exist; used when there is no need to create or update an object, but it is required in order to create a relationship)
  • name="UseTemplate" – used to specify code of the template, which should be used to create a new instance of the object)
  • name="Side" – used with the Relationship object type in order to specify side of the relationship; supported values are "Left" and "Right".

<links> Section

The <links> section defines AssetWise objects, which are related to the main object with intrinsic or named relationships. This section can have multiple <links> sections, which define a separate related object. For instance:

<links>

   <link type="relationship">
      <properties>
         <property name="useTemplate" value="IR-DOCUMENT_PROJECTS_OWNER-T"/>
      </properties>
      <links>
         <link type="Project">
            <properties>
               <property name="action" value="read" />
               <property name="side" value="right" />
               <property name="code" column_name="Project Code" />
            </properties>
         </link>
      </links>
   </link>

   <link type="File">
      <properties>
         <property name="name" column_name="eB File Name" />
         <property name="path" column_name="File Path" />
         <property name="documentcopy" column_name="Document Copy Name" />
         <property name="action" column_name="Action" />
      </properties>
   </link>

</links>

The <link> section supports the same attributes as the <object> section. It means it can have its own <link> subsections if there is a need to define a hierarchy. Intrinsic relationships, which do not require to use the Relationship object are defined directly (as <link type="File"> in the sample). All named relationships require using the Relationship object.

<attributes> Section

The <attributes> section allows to map object’s AssetWise attributes with Excel columns. This section should have a separate <attribute> section for each attribute. For example:

<attributes>
   <attribute name="AttributeNameInEB1" column_name="ColumNameInExcel1"/>
   <attribute name="AttributeNameInEB2" column_name="ColumNameInExcel2"/>
</attributes>

<export> Section

The <export> section defines eQL query, which should be used to export a particular sheet.

Note: The sheet must be defined as exportable (eg. <sheet name="Scopes" export_enabled="true">)
The defined eQL query must comply with the following criteria:
  • All returned column names must match Excel column names defined in the <properties> sections. However, all not alphanumeric symbols (excluding underscore) should be removed. For example, column name "Excel Column Name" should have an eQL alias defined as "ExcelColumnName", otherwise the system will not be able to retrieve correct column name ("Excel Column Name") from the mapping file and eQL column name ("ExcelColumnName") will be saved in Excel
  • eQL column order defines the order of Excel columns
  • Each Excel column used in any <properties> sections in the same worksheet must be mapped to an eQL column.

A sample export section could resemble the following:

<export>
   <eql text="START WITH EntityMetadata 
              SELECT Code MetadataEntityCode, Name MetadataEntityName, SchemaName,
                     Class.Code Class, AppliesTo.Type ObjectType, AppliesTo.Id 
                     ObjectId, 'CREATE' Action 
              WHERE 1 = 1"/>
</export>